package utils
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.geom.Matrix;
	import flash.geom.Point;

	/**
	 *
	 *@author CrazyChen 
	 *2013-4-1
	 */	
	public class MCDeleteBlack
	{
		/**
		 * 获得此影片剪辑所有帧bmd数据 
		 * @param mc
		 * @return 
		 * 
		 */
		public static function getNewMc(mc:MovieClip):Array{
			var total:int = mc.totalFrames;
			var arr:Array = [];
			for(var i:int=0;i<total;i++){
				mc.gotoAndStop(i);
				if(mc.width==0 || mc.height ==0)continue;
				var bmd:BitmapData = new BitmapData(mc.width,mc.height);
				bmd.draw(mc,new Matrix(1,0,0,1,mc.width/2,mc.height/2));
				var wid:int = bmd.width;
				var hid:int = bmd.height;
				for(var k:int=0;k<wid;k++){
					for(var j:int=0;j<hid;j++){
						var color:uint = bmd.getPixel(k,j);
						if(color<0x222222){
							bmd.setPixel32(k,j,0x00000000);
						}
					}
				}
				arr.push(bmd);
			}
			return arr;
		}
	}
}